package com.redtree.air.db
{
	import com.adobe.utils.DateUtil;
	
	import mx.formatters.DateFormatter;

	public class Note extends Constant
	{		

		private var _id:int;
		private var _title:String;
		private var _content:String;
		private var _dateInsert:Date;
		private var _tip:int;
		private var _timeTip:Date;
		private var _securityLevel:int;
		private var _securityName:String;
		private var _dateString:String;
		private var _dateTipString:String;
		private var _tipName:String;
		private var _tiped:int;
		private var _tipedString:String;
		
		public function Note(row:Object)
		{
			super();
			_id = row['id'];
			_title = row['title'];
			_content = row['content'];
			_dateInsert = row['date_insert'];
			_securityLevel = row['security_level'];
			_securityName = row['security_name'];
			_tip = row['tip'];
			_timeTip = row['time_tip'];
			_tiped = row['tiped'];
		}

		public function get dateString():String
		{
			var df:DateFormatter = new DateFormatter();
			df.formatString = 'YYYY/MM/DD HH:NN:SS'; 
			_dateString = df.format(_dateInsert);
			return _dateString;
		}

		public function set dateString(value:String):void
		{
			_dateString = value;
		}

		public function get securityLevel():int
		{
			return _securityLevel;
		}

		public function set securityLevel(value:int):void
		{
			_securityLevel = value;
		}

		public function get content():String
		{
			return _content;
		}

		public function set content(value:String):void
		{
			_content = value;
		}

		public function get title():String
		{
			return _title;
		}

		public function set title(value:String):void
		{
			_title = value;
		}

		public function get id():int
		{
			return _id;
		}

		public function set id(value:int):void
		{
			_id = value;
		}

		public function get dateInsert():Date
		{
			return DateUtil.getUTCDate(_dateInsert);
		}

		public function set dateInsert(value:Date):void
		{
			_dateInsert = value;
		}

		public function get securityName():String
		{
			return _securityName;
		}

		public function set securityName(value:String):void
		{
			_securityName = value;
		}

		public function get tip():int
		{
			return _tip;
		}

		public function set tip(value:int):void
		{
			_tip = value;
		}
		

		public function get timeTip():Date
		{			
			return _timeTip;
		}

		public function set timeTip(value:Date):void
		{
			_timeTip = value;
		}

		public function get tipName():String
		{
			 _tipName = '';
			 switch ( _tip )
			 {
				 case TIP_TYPE_NULL:_tipName = '不提示';break;
				 case TIP_TYPE_POPUP:_tipName = '弹出窗口';break;
				 case TIP_TYPE_SMS:_tipName = '弹出窗口';break;
				 case TIP_TYPE_POPUP_SMS:_tipName = '弹出窗口';break;
			 }
			 return _tipName;
		}

		public function set tipName(value:String):void
		{
			_tipName = value;
		}

		public function get dateTipString():String
		{
			var df:DateFormatter = new DateFormatter();
			df.formatString = 'YYYY/MM/DD HH:NN:SS'; 
			_dateTipString = df.format(_timeTip);
			return _dateTipString;
		}

		public function set dateTipString(value:String):void
		{
			_dateTipString = value;
		}

		public function get tiped():int
		{
			return _tiped;
		}

		public function set tiped(value:int):void
		{
			_tiped = value;
		}

		public function get tipedString():String
		{
			return (tip==TIP_TYPE_NULL)?' ':((_tiped==TIP_UNTIPED)?'未提醒':'已提醒');;
		}

		public function set tipedString(value:String):void
		{
			_tipedString = value;
		}


	}
}